package com.swsc.solarverse.model.biz;

import com.swsc.solarverse.common.model.BaseVO;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

/**
 * @Author chencl
 * @Date 2023/3/11 11:28
 * @Version 1.0
 * @Description
 */
@NoArgsConstructor
@lombok.Data
public class StringDataPowerDTO extends BaseVO {
    private Long devicePid;
    private Long deviceId;
    private String deviceName;
    private LocalDateTime dataTime;

    private Double p;

    private String deviceCode;

    public String getDeviceCode() {
        return ((null != deviceCode && !"".equals(deviceCode.trim())) ? deviceCode : devicePid + "-" + deviceId);
    }

    public StringDataPowerDTO(Integer tenantNo, Integer organNo, Long devicePid, Long deviceId, String deviceName, LocalDateTime dataTime) {
        super(tenantNo, organNo);
        this.devicePid = devicePid;
        this.deviceId = deviceId;
        this.deviceName = deviceName;
        this.dataTime = dataTime;
    }

    public StringDataPowerDTO(Integer tenantNo, Integer organNo, Long devicePid, Long deviceId, String deviceName, String deviceCode, LocalDateTime dataTime) {
        super(tenantNo, organNo);
        this.devicePid = devicePid;
        this.deviceId = deviceId;
        this.deviceName = deviceName;
        this.deviceCode = deviceCode;
        this.dataTime = dataTime;
    }
}
